#include <cstdint>
#include <iostream>
#include <istream>
using ll = int64_t;

ll n,p;

static inline ll exgcd(ll a,ll b,ll&x,ll&y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll gcd=exgcd(b, a%b, y, x);
    y-=a/b*x;
    return gcd;
}

int main(){
    std::iostream::sync_with_stdio(false);
    std::cin.tie(nullptr);

    std::cin>>n>>p;
    for(ll i=1;i<=n;i++){
        ll x,y;
        exgcd(i, p, x, y);
        std::cout<<(x%p+p)%p<<"\n";
    }
}